import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Random;


public class AddDatesToTwitterData {
	static final String DELIMITER = "\t";

	public static void main(String[] args) {
		String edgeInput = args[0];
		String edgeOutput = args[1];
		String attributeOutput = args[2];
		
		try {
    		FileInputStream fstream = new FileInputStream(edgeInput);
    		DataInputStream in = new DataInputStream(fstream);
    		BufferedReader br = new BufferedReader(new InputStreamReader(in));
    		PrintWriter edgeWriter = new PrintWriter(new FileWriter(edgeOutput));
    		PrintWriter attributeWriter = new PrintWriter(new FileWriter(attributeOutput));
    		
    		String strLine;
    		int lineCount = 0;
    		Random generator = new Random();
    		while ((strLine = br.readLine()) != null) {
    			String[] tmp = strLine.split(DELIMITER);
    			edgeWriter.println(tmp[0] + "\t" + lineCount + "\t" + tmp[2]);
    			int year = 2007 + generator.nextInt(6);
    			int month = generator.nextInt(12) + 1;
    			String monthString;
    			if (month < 10)
    				monthString = "0" + month;
    			else 
    				monthString = "" + month;
    			int day = generator.nextInt(28) + 1;
    			String dayString;
    			if (day < 10)
    				dayString = "0" + day;
    			else 
    				dayString = "" + day;
    			attributeWriter.println(lineCount + "\t" + "d" + "\t" + year + "-" + monthString + "-" + dayString);
    			lineCount++;
    		}
    		in.close();
    		edgeWriter.close();
    		attributeWriter.close();
    	} catch (Exception e) {
    		System.err.println("Error: " + e.getMessage());
    	}
	}
}
